﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection" />
    <title>首页</title>
    <script type="text/javascript" charset="utf-8" src="js/phonegap-1.4.1.js"></script>
    <script src="js/jquery/jquery-1.8.1.min.js" type="text/javascript"></script>
    <script src="js/config.js" type="text/javascript"></script>
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <link href="css/btnsty.css" rel="stylesheet" type="text/css" />
    <script src="js/Toast.js" type="text/javascript"></script>
    <style>
        #btns
        {
            padding: 10px;
        }
        .menu_lsit
        {
            display: block;
            width: 100%;
        }
        .a_menu
        {
            position: absolute;
        }
        .a_menu a
        {
            float: left;
            padding: 5px;
        }
        .a_menu a div
        {
            width: 60px;
            height: 45px;
        }
        .a_menu a img
        {
            position: fixed;
            padding-left: 50px;
            padding-top: 30px;
            height: 20px;
            width: 20px;
            display: none;
        }
    </style>
    <script type="text/javascript">
        $(function () {
            LoadMenu();
            if (my_ClientType == "web" || my_ClientType == "MobileWeb") {
                $("#btn_out").text("注销");
            }
            $("#btn_out").live("click", function () {
                //                if (confirm("确认退出?")) {
                //                    
                //window.location.href = 'login.html';
                //                }
                if (my_ClientType == "android") {
                    showConfirm("是否要退出？");
                    localStorage.removeItem("UserID");
                    localStorage.removeItem("UserCode");
                    localStorage.removeItem("UserName");
                } else {
                    if (confirm("确认退出系统?")) {
                        //window.location.href = 'login.html';
                        //localStorage.removeItem("UserID");
                        //localStorage.removeItem("UserCode");
                        //localStorage.removeItem("UserName");
                        LoginOut();
                    }
                }

            });
            function LoginOut() {
                UserCode = localStorage.getItem("UserCode");
                $.post(url_path + "/ajaxdata/login.aspx",
                    { aciton: 'LoginOut', UserCode: UserCode },
                    function (data) {
                        var msg = $.trim(data);
                        localStorage.removeItem("UserID");
                        localStorage.removeItem("UserCode");
                        localStorage.removeItem("UserName");
                        window.location.href = 'login.html';
                    });
            }
            function LoadMenu() {
                USER_ID = localStorage.getItem("UserID");
                if (USER_ID == null) {
                    alert('登录已过期，请重新登录！');
                    window.location.href = 'login.html';
                }
                $.ajax({
                    url: url_path + "/ajaxdata/Default.aspx",
                    type: "POST",
                    data: { aciton: 'GetUserMenus', userid: USER_ID },
                    timeout: 30000,
                    dataType: "text",
                    success: function (data) {
                        var msg = $.trim(data);
                        var Objdata = JSON.parse(msg);
                        var html = '';
                        if (Objdata.length == 0) {
                            $("#no_data").show();
                        } else {
                            $("#no_data").hide();
                            for (var i = 0; i < Objdata.length; i++) {
                                html += '<a class="a_btn" mid="' + Objdata[i].ModuleCode + '" url="../' + Objdata[i].WebUrl + '" href="#">'
                                    + '    <div class="button s_medium medium-' + ((i % 2 == 0) ? 'red' : 'blue') + ' btn_shadow">'
                                    + '        <img src="images/chart_bar.png" /><span>' + Objdata[i].ModuleName + '</span></div>'
                                    + '</a>'
                            }
                        }
                        $(".a_menu").html(html);
                    },
                    error: function () {
                        showtoast("通讯超时,请检查网络.", null, 100, 100);
                    }
                });
            }
            // callback function
            function onConfirm(button) {
                // if press 'Yes'
                if (button === 1) {
                    navigator.app.exitApp();
                }
            }
            $(".a_btn").live("click", function () {
                USER_ID = localStorage.getItem("UserID");
                if (USER_ID == null) {
                    alert('登录已过期，请重新登录！');
                    window.location.href = 'login.html';
                }
                //alert(USER_ID);
                var url = $(this).attr("url");
                var mcode = $(this).attr("mid");
                $.ajax({
                    url: url_path + "/ajaxdata/Default.aspx",
                    type: "POST",
                    data: { aciton: 'CheckRights', modecode: mcode, userid: USER_ID },
                    timeout: 30000,
                    dataType: "text",
                    success: function (data) {
                        var msg = $.trim(data);
                        if (msg == "NO_RIGHT") {
                            showtoast("没有权限访问！", null, null, null);
                        } else {
                            window.location.href = url;
                        }
                    },
                    error: function () {
                        showtoast("通讯超时,请检查网络.", null, 100, 100);
                    }
                });
            });
            //            $.post(url_path + "/ajaxdata/login.aspx",
            //                    { aciton: 'GetUser' },
            //                     function (data) {
            //                         var msg = $.trim(data);
            //                         if (msg == "NOUSER") {
            //                             showtoast("登录信息过期，请重新登录！",null,null,null);
            //                             window.location.href = 'login.html';
            //                         }
            //                     });
            if (my_ClientType == "android") {
                document.addEventListener("backbutton", onBackKeyDown, false);
            }
            //返回键
            function onBackKeyDown() {
                showConfirm();
            }
            // callback function
            function onConfirm(button) {
                // if press 'Yes'
                if (button === 1) {
                    navigator.app.exitApp();
                }
            }
            // PhoneGap Notification 提供的 Confirm API
            function showConfirm() {
                navigator.notification.confirm(
               '確定要离开么?',  // message
               onConfirm,            // callback function
               '消息',               // title
               'Yes,No'              // confirm 選項，用逗號隔開
                );
            }
        });
    </script>
</head>
<body>
    <div id="menu">
        <ul>
            <li class="nav_about"><a href="ShopDayTarget.html"><i></i><span>店铺每日目标</span><b></b><div
                class="clear">
            </div>
            </a></li>
            <li class="nav_about"><a href="ShopWeekTarget.html"><i></i><span>店铺周目标</span><b></b><div
                class="clear">
            </div>
            </a></li>
        </ul>
    </div>
    <div id="header" class="head">
        <div class="wrap">
            <i class="menu_open"></i>
            <div class="title">
                <span class="title_d">
                    <p>
                        KM移动数据平台</p>
                </span>
                <div class="clear">
                </div>
            </div>
            <i style="position: fixed; right: 3px; top: 15px;"><a href="#" class="button" id="btn_out">
                退出</a></i>
        </div>
        <div class="logo_msk">
        </div>
    </div>
    <div id="container">
        <div>
            <div id="btns">
                <ul>
                    <li>
                        <div class="wrap">
                            <div class="menu_lsit">
                                数据查询
                                 <div id="no_data" style="text-align: center;width:100%; display:none;">
                                        对不起，您没有任何权限功能！</div>
                                <div class="a_menu">
                                    <!--<a class="a_btn" mid="M_PRT1" url="report1.html" href="#">
                                        <div class="button s_medium medium-red btn_shadow">
                                            <img src="images/chart_bar.png" /><span>移动数据查询（公司）</span></div>
                                    </a><a class="a_btn" mid="M_PRT2" url="report2.html" href="#">
                                        <div class="button s_medium medium-blue btn_shadow">
                                            <img src="images/chart_bar.png" />移动数据查询（店铺）</div>
                                    </a><a class="a_btn" mid="M_PRT3" url="report3.html" href="#">
                                        <div class="button s_medium medium-orange btn_shadow">
                                            <img src="images/chart_bar.png" />每日业绩明细表</div>
                                    </a><a class="a_btn" mid="M_PRT4" url="report5.html" href="#">
                                        <div class="button s_medium medium-orange btn_shadow">
                                            <img src="images/chart_bar.png" />店铺业绩简报</div>
                                    </a><a class="a_btn" mid="M_PRT5" url="report6.html" href="#">
                                        <div class="button s_medium medium-blue btn_shadow">
                                            <img src="images/chart_bar.png" />店铺目标分析表</div>
                                    </a><a class="a_btn" mid="M_PRT8" url="report8.html" href="#">
                                        <div class="button s_medium medium-blue btn_shadow">
                                            <img src="images/chart_bar.png" />店铺业绩查询</div>
                                    </a>-->
                                </div>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <script language="javascript" src="js/zepto.min.js"></script>
    <script language="javascript" src="js/fx.js"></script>
    <script language="javascript" src="js/script.js"></script>
</body>
</html>
